﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace WeChatParking.Core.Payment.Alipay
{
   
   //服务器异步通知模型
   public class AlipayNotifyModel
   {
        //====================基本参数=================
       /// <summary>
       /// 通知时间
       /// </summary>
       public string NotifyTime { get; set; }

       /// <summary>
       /// 通知类型
       /// </summary>
       public string NotifyType { get; set; }

       /// <summary>
       /// 通知校验ID
       /// </summary>
       public string NotifyID { get; set; }

        /// <summary>
       /// 签名方式
       /// </summary>
       public string SignType { get; set; }

        /// <summary>
       /// 签名
       /// </summary>
       public string Sign { get; set; }

       //====================业务参数=================

       /// <summary>
       ///商户网站唯一订单号
       /// </summary>
       public string OutTradeNo { get; set; }

       /// <summary>
       /// 商品名称 
       /// </summary>
       public string Subject { get; set; }

       /// <summary>
       /// 支付类型  
       /// </summary>
       public string PaymentType { get; set; }


       /// <summary>
       /// 支付宝交易号  
       /// </summary>
       public string TradeNo { get; set; }

       /// <summary>
       /// 交易状态 成功的状态值：TRADE_FINISHED(普通)、TRADE_SUCCESS(高级)
       /// </summary>
       public string TradeStatus { get; set; }

       /// <summary>
       /// 交易创建时间
       /// </summary>
       public string GmtCreate { get; set; }

       /// <summary>
       /// 交易付款时间
       /// </summary>
       public string GmtPayment { get; set; }

       /// <summary>
       /// 交易关闭时间
       /// </summary>
       public string GmtClose { get; set; }

       /// <summary>
       /// 退款状态
       /// </summary>
       public string RefundStatus { get; set; }

       /// <summary>
       /// 退款时间
       /// </summary>
       public string GmtRefund { get; set; }

        /// <summary>
       /// 卖家支付宝账号   
       /// </summary>
       public string SellerEmail { get; set; } 

       /// <summary>
       /// 买家支付宝账号   
       /// </summary>
       public string BuyerEmail { get; set; }

       /// <summary>
       /// 卖家支付宝用户号   
       /// </summary>
       public string SellerID { get; set; } 

       /// <summary>
       /// 买家支付宝用户号   
       /// </summary>
       public string BuyerID { get; set; }

        /// <summary>
       /// 商品单价   
       /// </summary>
       public string Price { get; set; }

       /// <summary>
       /// 交易金额   
       /// </summary>
       public string TotalFee { get; set; }

        /// <summary>
       /// 购买数量   
       /// </summary>
       public string Quantity { get; set; }

       /// <summary>
       /// 商品描述   
       /// </summary>
       public string Body { get; set; }

         /// <summary>
       /// 折扣   
       /// </summary>
       public string Discount { get; set; }

       /// <summary>
       /// 是否调整总价   
       /// </summary>
       public string IsTotalFeeAdjust { get; set; }
       
       /// <summary>
       /// 是否使用红包买家   
       /// </summary>
       public string UseCoupon { get; set; }

       /// <summary>
       /// 公用回传参数   
       /// </summary>
       public string ExtraCommonParam { get; set; }

       /// <summary>
       /// 支付渠道组合信息   
       /// </summary>
       public string OutChannelType { get; set; }
       /// <summary>
       /// 支付金额组合信息   
       /// </summary>
       public string OutChannelAmount { get; set; }

       /// <summary>
       /// 实际支付渠道   
       /// </summary>
       public string OutChannelInst { get; set; }
       /// <summary>
       /// 是否扫码支付   
       /// </summary>
       public string BusinessScene { get; set; }

       public AlipayNotifyModel(Dictionary<string, string> parameters)
       {
           NotifyTime = parameters["notify_time"];
           NotifyType = parameters["notify_type"];
           NotifyID = parameters["notify_id"];
           SignType = parameters["sign_type"];
           Sign = parameters["sign"];

           OutTradeNo = parameters.ContainsKey("out_trade_no") == false ? null : parameters["out_trade_no"];
           Subject = parameters.ContainsKey("subject") == false ? null : parameters["subject"];
           PaymentType = parameters.ContainsKey("payment_type") == false ? null : parameters["payment_type"];

           TradeNo = parameters.ContainsKey("trade_no") == false ? null : parameters["trade_no"];
           TradeStatus = parameters.ContainsKey("trade_status") == false ? null : parameters["trade_status"];

           GmtCreate = parameters.ContainsKey("gmt_create") == false ? null : parameters["gmt_create"];
           GmtPayment = parameters.ContainsKey("gmt_payment") == false ? null : parameters["gmt_payment"];
           GmtClose = parameters.ContainsKey("gmt_close") == false ? null : parameters["gmt_close"];
           RefundStatus = parameters.ContainsKey("refund_status") == false ? null : parameters["refund_status"];
           GmtRefund = parameters.ContainsKey("gmt_refund") == false ? null : parameters["gmt_refund"];

           SellerEmail = parameters.ContainsKey("seller_email") == false ? null : parameters["seller_email"];
           BuyerEmail = parameters.ContainsKey("buyer_email") == false ? null : parameters["buyer_email"];
           SellerID = parameters.ContainsKey("seller_id") == false ? null : parameters["seller_id"];
           BuyerID = parameters.ContainsKey("buyer_id") == false ? null : parameters["buyer_id"];
           Price = parameters.ContainsKey("price") == false ? null : parameters["price"];

           TotalFee = parameters.ContainsKey("total_fee") == false ? null : parameters["total_fee"];
           Quantity = parameters.ContainsKey("quantity") == false ? null : parameters["quantity"];
           Body = parameters.ContainsKey("body") == false ? null : parameters["body"];
           Discount = parameters.ContainsKey("discount") == false ? null : parameters["discount"];
           IsTotalFeeAdjust = parameters.ContainsKey("is_total_fee_adjust") == false ? null : parameters["is_total_fee_adjust"];
           UseCoupon = parameters.ContainsKey("use_coupon") == false ? null : parameters["use_coupon"];
           ExtraCommonParam = parameters.ContainsKey("extra_common_param") == false ? null : parameters["extra_common_param"];
           OutChannelType = parameters.ContainsKey("out_channel_type") == false ? null : parameters["out_channel_type"];
           OutChannelAmount = parameters.ContainsKey("out_channel_amount") == false ? null : parameters["out_channel_amount"];
           OutChannelInst = parameters.ContainsKey("out_channel_inst") == false ? null : parameters["out_channel_inst"];
           BusinessScene = parameters.ContainsKey("business_scene") == false ? null : parameters["business_scene"];

       }  

      


    
    }
}
